package day06;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Description: keyby分组 分组累加求和
 * @Author: ZYX
 * @Date: 2022/2/16 13:48
 * @Version: 1.0
 */
public class Demo07 {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);

        env.fromElements(1,2,3,4,5)
                .keyBy(obj -> obj %2)
                .sum(0)
                .print();

        env.execute();
    }

}
